function Install-BigGit {
<#
.SYNOPSIS
A convenience function for the initial setup of BigGit on a machine that creates all TFS workspaces, installs dependencies and creates git repositories.

.DESCRIPTION
This wraps the Add-NonVolitileEnlistment, Add-VolitileEnlistmentm, Add-PartialBranch, Add-PartialBranchGitClone and Install-Git functions to perform all necesary setup of a BigGit setup. When done, there will be a NonVolatile, Volatile, Branch and Git subdirectory under LocalPath containing each workspace/repo.

.PARAMETER TfsUrl
The TFS Collection URL to use for connecting to TFS

.PARAMETER ServerPathToBranch
Server path of the TFS directory being branched

.PARAMETER PartialBranchPath
Server path of destination branch

.PARAMETER LocalPath
Local path where the workspaces and repositories will be rooted

.PARAMETER NonVolatileMappings
List of mappings to to be passed to the Add-NonVolatileEnlistment function

.PARAMETER VolatileMappings
List of mappings to to be passed to the Add-VolatileEnlistment function

.PARAMETER RemoteOrigin
Path where a bare git repository will be cloned to and added as the origin Remote of the git repo


.EXAMPLE
$tfsMinimal = "myWorkspace;Matt Wrock"
$tfsUrl = "http://server:8080/tfs"
$NonVolatileMappings = Invoke-TF workfold /collection:$tfsUrl /workspace:$tfsMinimal | ?{ $_.ToLower() -match "(/externalLibs(/|:))|(/drops(/|:))"}

$VolatileMappings = Invoke-TF workfold /collection:$tfsUrl /workspace:$tfsMinimal | ?{ $_.ToLower() -notmatch "(/externalLibs(/|:))|(/drops(/|:))"}

Install-BigGit -tfsUrl $tfsUrl -serverPathToBranch $/my/branch -partialBranchPath $/my/partial/branch -localPath c:\dev -remoteOrigin \\server\share -NonVolatileMappings $NonVolatileMappings -VolatileMappings $VolatileMappings

.LINK
https://BigGit.Codeplex.com
Add-VolitileEnlistment
Add-NonVolitileEnlistment
Add-PartialBranch
Add-PartialBranchGitClone
Install-Git
#>   
    param(
        [Parameter(Mandatory=$true)]
        [string] $tfsUrl, 
        [Parameter(Mandatory=$true)]
        [string] $serverPathToBranch,
        [Parameter(Mandatory=$true)] 
        [string] $partialBranchPath,
        [Parameter(Mandatory=$true)] 
        [string] $localPath, 
        [string[]] $NonVolatileMappings = $null, 
        [string[]] $VolatileMappings = $null, 
        [string] $remoteOrigin = $null
    )
    $localPath = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($localPath)

    if(!(Test-Path $localPath)) {
        mkdir $localPath
    }
    if(!(Test-Path (Join-Path $localPath BigGitConfig.xml))){
        [xml]$config = "<config></config>"
        $config.Save((Join-Path $localPath BigGitConfig.xml))
    }

    if($NonVolatileMappings){
        Add-NonVolatileEnlistment $NonVolatileMappings -branch $serverPathToBranch -tfsUrl $tfsUrl -localSourcePath "$localPath\NonVolatile"
    }
    Add-VolatileEnlistment $VolatileMappings -branch $serverPathToBranch -tfsUrl $tfsUrl -localSourcePath "$localPath\Volatile\src"
    Invoke-TF workfold /workspace:$(Get-WorkspaceName "$localPath\Volatile\src") | Add-PartialBranch -serverPathToBranch $serverPathToBranch -partialBranchPath $partialBranchPath -tfsUrl $tfsUrl -localSourcePath "$localPath\branch\src" -localPathToken "$localPath\Volatile\src"
    Install-Git
    Add-PartialBranchGitClone $tfsUrl $partialBranchPath "$localPath\git\src" $remoteOrigin

    Write-BigGitMessage "You have successfully setup a git repo with BigGit!" -foregroundColor darkgreen
    Write-BigGitMessage "Your git repository is located at $localPath\git\src. This is where you should do your work." -foregroundColor darkgreen
    Write-BigGitMessage "Your Non-Volatile enlistment is located at $localPath\NonVolatile. Call Invoke-TF Get from there when you want to sync" -foregroundColor darkgreen
    Write-BigGitMessage "Your Volatile and partial branch enlistments are located at $localPath\Volatile\src and $localPath\branch\src. These exist primarily for merging purposes and you may not need to work with them directly." -foregroundColor darkgreen
    Write-BigGitMessage "Use Invoke-ForwardIntegration to sync your git repo master branch with the latest changes from TFS" -foregroundColor darkgreen
    Write-BigGitMessage "Use Invoke-ReverseIntegration to sync TFS with your git master branch" -foregroundColor darkgreen
}
